import { defineStore } from 'pinia'

export const useSettings = defineStore('settings', {
  state: () => ({
    //左侧菜单是否折叠
    isCollapse: false,
    //左侧当前激活菜单
    activeMenu: '/'
  }),
  actions: {
    //切换左侧菜单折叠状态
    setIsCollapse(isCollapse) {
      this.isCollapse = isCollapse
    },
    //设置左侧当前激活菜单
    setActiveMenu(activeMenu) {
      this.activeMenu = activeMenu
    }
  },
  getters: {
    //左侧菜单折叠状态
    // collapse: (state) => state.isCollapse
  },
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'settings',
        storage: window.localStorage
      }
    ]
  }
})
